package com.ddyx.rest.user;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.user.UCompanyService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

@Controller
@RequestMapping("/company")
public class UCompanyController {
	
	@Resource
	UCompanyService uCompanyService;
	/**
	 * 获取公司列表
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/getCompanyList")
	public ResponseForm getCompanyList() {
		return uCompanyService.getCompanyList();
	}
	/**
	 * 获取公司分页列表
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getCompanyListPage",method=RequestMethod.POST)
	public ResponseForm getBrandListPage(@RequestBody RequestForm param) {
		return uCompanyService.getCompanyListPage(param);
	}
	
	/**
	 * 新增公司
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/addCompany",method=RequestMethod.POST)
	public ResponseForm addCompany(@RequestBody RequestForm param) {
		return uCompanyService.addCompany(param);
	}
	

	/**
	 * 修改公司
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/updateCompany",method=RequestMethod.POST)
	public ResponseForm updateCompany(@RequestBody RequestForm param) {
		return uCompanyService.updateCompany(param);
	}
	
	/**
	 * 根据ID查询公司信息
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getCompanyById",method=RequestMethod.POST)
	public ResponseForm getCompanyById(@RequestBody RequestForm param) {
		return uCompanyService.getCompanyById(param);
	}
}
